#include <stdint.h>

uint8_t mask[8]=
{
	128,
	64,
	32,
	16,
	8,
	4,
	2,
	1
};

//auto gen by gen_free_list_map.cpp
uint8_t off_list_map[256][8]=
{
	{0,1,2,3,4,5,6,7},/*0*/
	{0,1,2,3,4,5,6,0},/*1*/
	{0,1,2,3,4,5,7,0},/*2*/
	{0,1,2,3,4,5,0,0},/*3*/
	{0,1,2,3,4,6,7,0},/*4*/
	{0,1,2,3,4,6,0,0},/*5*/
	{0,1,2,3,4,7,0,0},/*6*/
	{0,1,2,3,4,0,0,0},/*7*/
	{0,1,2,3,5,6,7,0},/*8*/
	{0,1,2,3,5,6,0,0},/*9*/
	{0,1,2,3,5,7,0,0},/*10*/
	{0,1,2,3,5,0,0,0},/*11*/
	{0,1,2,3,6,7,0,0},/*12*/
	{0,1,2,3,6,0,0,0},/*13*/
	{0,1,2,3,7,0,0,0},/*14*/
	{0,1,2,3,0,0,0,0},/*15*/
	{0,1,2,4,5,6,7,0},/*16*/
	{0,1,2,4,5,6,0,0},/*17*/
	{0,1,2,4,5,7,0,0},/*18*/
	{0,1,2,4,5,0,0,0},/*19*/
	{0,1,2,4,6,7,0,0},/*20*/
	{0,1,2,4,6,0,0,0},/*21*/
	{0,1,2,4,7,0,0,0},/*22*/
	{0,1,2,4,0,0,0,0},/*23*/
	{0,1,2,5,6,7,0,0},/*24*/
	{0,1,2,5,6,0,0,0},/*25*/
	{0,1,2,5,7,0,0,0},/*26*/
	{0,1,2,5,0,0,0,0},/*27*/
	{0,1,2,6,7,0,0,0},/*28*/
	{0,1,2,6,0,0,0,0},/*29*/
	{0,1,2,7,0,0,0,0},/*30*/
	{0,1,2,0,0,0,0,0},/*31*/
	{0,1,3,4,5,6,7,0},/*32*/
	{0,1,3,4,5,6,0,0},/*33*/
	{0,1,3,4,5,7,0,0},/*34*/
	{0,1,3,4,5,0,0,0},/*35*/
	{0,1,3,4,6,7,0,0},/*36*/
	{0,1,3,4,6,0,0,0},/*37*/
	{0,1,3,4,7,0,0,0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,6,0,0,0},/*81*/
	{0,2,4,5,7,0,0,0},/*82*/
	{0,2,4,5,0,0,0,0},/*83*/
	{0,2,4,6,7,0,0,0},/*84*/
	{0,2,4,6,0,0,0,0},/*85*/
	{0,2,4,7,0,0,0,0},/*86*/
	{0,2,4,0,0,0,0,0},/*87*/
	{0,2,5,6,7,0,0,0},/*88*/
	{0,2,5,6,0,0,0,0},/*89*/
	{0,2,5,7,0,0,0,0},/*90*/
	{0,2,5,0,0,0,0,0},/*91*/
	{0,2,6,7,0,0,0,0},/*92*/
	{0,2,6,0,0,0,0,0},/*93*/
	{0,2,7,0,0,0,0,0},/*94*/
	{0,2,0,0,0,0,0,0},/*95*/
	{0,3,4,5,6,7,0,0},/*96*/
	{0,3,4,5,6,0,0,0},/*97*/
	{0,3,4,5,7,0,0,0},/*98*/
	{0,3,4,5,0,0,0,0},/*99*/
	{0,3,4,6,7,0,0,0},/*100*/
	{0,3,4,6,0,0,0,0},/*101*/
	{0,3,4,7,0,0,0,0},/*102*/
	{0,3,4,0,0,0,0,0},/*103*/
	{0,3,5,6,7,0,0,0},/*104*/
	{0,3,5,6,0,0,0,0},/*105*/
	{0,3,5,7,0,0,0,0},/*106*/
	{0,3,5,0,0,0,0,0},/*107*/
	{0,3,6,7,0,0,0,0},/*108*/
	{0,3,6,0,0,0,0,0},/*109*/
	{0,3,7,0,0,0,0,0},/*110*/
	{0,3,0,0,0,0,0,0},/*111*/
	{0,4,5,6,7,0,0,0},/*112*/
	{0,4,5,6,0,0,0,0},/*113*/
	{0,4,5,7,0,0,0,0},/*114*/
	{0,4,5,0,0,0,0,0},/*115*/
	{0,4,6,7,0,0,0,0},/*116*/
	{0,4,6,0,0,0,0,0},/*117*/
	{0,4,7,0,0,0,0,0},/*118*/
	{0,4,0,0,0,0,0,0},/*119*/
	{0,5,6,7,0,0,0,0},/*120*/
	{0,5,6,0,0,0,0,0},/*121*/
	{0,5,7,0,0,0,0,0},/*122*/
	{0,5,0,0,0,0,0,0},/*123*/
	{0,6,7,0,0,0,0,0},/*124*/
	{0,6,0,0,0,0,0,0},/*125*/
	{0,7,0,0,0,0,0,0},/*126*/
	{0,0,0,0,0,0,0,0},/*127*/
	{1,2,3,4,5,6,7,0},/*128*/
	{1,2,3,4,5,6,0,0},/*129*/
	{1,2,3,4,5,7,0,0},/*130*/
	{1,2,3,4,5,0,0,0},/*131*/
	{1,2,3,4,6,7,0,0},/*132*/
	{1,2,3,4,6,0,0,0},/*133*/
	{1,2,3,4,7,0,0,0},/*134*/
	{1,2,3,4,0,0,0,0},/*135*/
	{1,2,3,5,6,7,0,0},/*136*/
	{1,2,3,5,6,0,0,0},/*137*/
	{1,2,3,5,7,0,0,0},/*138*/
	{1,2,3,5,0,0,0,0},/*139*/
	{1,2,3,6,7,0,0,0},/*140*/
	{1,2,3,6,0,0,0,0},/*141*/
	{1,2,3,7,0,0,0,0},/*142*/
	{1,2,3,0,0,0,0,0},/*143*/
	{1,2,4,5,6,7,0,0},/*144*/
	{1,2,4,5,6,0,0,0},/*145*/
	{1,2,4,5,7,0,0,0},/*146*/
	{1,2,4,5,0,0,0,0},/*147*/
	{1,2,4,6,7,0,0,0},/*148*/
	{1,2,4,6,0,0,0,0},/*149*/
	{1,2,4,7,0,0,0,0},/*150*/
	{1,2,4,0,0,0,0,0},/*151*/
	{1,2,5,6,7,0,0,0},/*152*/
	{1,2,5,6,0,0,0,0},/*153*/
	{1,2,5,7,0,0,0,0},/*154*/
	{1,2,5,0,0,0,0,0},/*155*/
	{1,2,6,7,0,0,0,0},/*156*/
	{1,2,6,0,0,0,0,0},/*157*/
	{1,2,7,0,0,0,0,0},/*158*/
	{1,2,0,0,0,0,0,0},/*159*/
	{1,3,4,5,6,7,0,0},/*160*/
	{1,3,4,5,6,0,0,0},/*161*/
	{1,3,4,5,7,0,0,0},/*162*/
	{1,3,4,5,0,0,0,0},/*163*/
	{1,3,4,6,7,0,0,0},/*164*/
	{1,3,4,6,0,0,0,0},/*165*/
	{1,3,4,7,0,0,0,0},/*166*/
	{1,3,4,0,0,0,0,0},/*167*/
	{1,3,5,6,7,0,0,0},/*168*/
	{1,3,5,6,0,0,0,0},/*169*/
	{1,3,5,7,0,0,0,0},/*170*/
	{1,3,5,0,0,0,0,0},/*171*/
	{1,3,6,7,0,0,0,0},/*172*/
	{1,3,6,0,0,0,0,0},/*173*/
	{1,3,7,0,0,0,0,0},/*174*/
	{1,3,0,0,0,0,0,0},/*175*/
	{1,4,5,6,7,0,0,0},/*176*/
	{1,4,5,6,0,0,0,0},/*177*/
	{1,4,5,7,0,0,0,0},/*178*/
	{1,4,5,0,0,0,0,0},/*179*/
	{1,4,6,7,0,0,0,0},/*180*/
	{1,4,6,0,0,0,0,0},/*181*/
	{1,4,7,0,0,0,0,0},/*182*/
	{1,4,0,0,0,0,0,0},/*183*/
	{1,5,6,7,0,0,0,0},/*184*/
	{1,5,6,0,0,0,0,0},/*185*/
	{1,5,7,0,0,0,0,0},/*186*/
	{1,5,0,0,0,0,0,0},/*187*/
	{1,6,7,0,0,0,0,0},/*188*/
	{1,6,0,0,0,0,0,0},/*189*/
	{1,7,0,0,0,0,0,0},/*190*/
	{1,0,0,0,0,0,0,0},/*191*/
	{2,3,4,5,6,7,0,0},/*192*/
	{2,3,4,5,6,0,0,0},/*193*/
	{2,3,4,5,7,0,0,0},/*194*/
	{2,3,4,5,0,0,0,0},/*195*/
	{2,3,4,6,7,0,0,0},/*196*/
	{2,3,4,6,0,0,0,0},/*197*/
	{2,3,4,7,0,0,0,0},/*198*/
	{2,3,4,0,0,0,0,0},/*199*/
	{2,3,5,6,7,0,0,0},/*200*/
	{2,3,5,6,0,0,0,0},/*201*/
	{2,3,5,7,0,0,0,0},/*202*/
	{2,3,5,0,0,0,0,0},/*203*/
	{2,3,6,7,0,0,0,0},/*204*/
	{2,3,6,0,0,0,0,0},/*205*/
	{2,3,7,0,0,0,0,0},/*206*/
	{2,3,0,0,0,0,0,0},/*207*/
	{2,4,5,6,7,0,0,0},/*208*/
	{2,4,5,6,0,0,0,0},/*209*/
	{2,4,5,7,0,0,0,0},/*210*/
	{2,4,5,0,0,0,0,0},/*211*/
	{2,4,6,7,0,0,0,0},/*212*/
	{2,4,6,0,0,0,0,0},/*213*/
	{2,4,7,0,0,0,0,0},/*214*/
	{2,4,0,0,0,0,0,0},/*215*/
	{2,5,6,7,0,0,0,0},/*216*/
	{2,5,6,0,0,0,0,0},/*217*/
	{2,5,7,0,0,0,0,0},/*218*/
	{2,5,0,0,0,0,0,0},/*219*/
	{2,6,7,0,0,0,0,0},/*220*/
	{2,6,0,0,0,0,0,0},/*221*/
	{2,7,0,0,0,0,0,0},/*222*/
	{2,0,0,0,0,0,0,0},/*223*/
	{3,4,5,6,7,0,0,0},/*224*/
	{3,4,5,6,0,0,0,0},/*225*/
	{3,4,5,7,0,0,0,0},/*226*/
	{3,4,5,0,0,0,0,0},/*227*/
	{3,4,6,7,0,0,0,0},/*228*/
	{3,4,6,0,0,0,0,0},/*229*/
	{3,4,7,0,0,0,0,0},/*230*/
	{3,4,0,0,0,0,0,0},/*231*/
	{3,5,6,7,0,0,0,0},/*232*/
	{3,5,6,0,0,0,0,0},/*233*/
	{3,5,7,0,0,0,0,0},/*234*/
	{3,5,0,0,0,0,0,0},/*235*/
	{3,6,7,0,0,0,0,0},/*236*/
	{3,6,0,0,0,0,0,0},/*237*/
	{3,7,0,0,0,0,0,0},/*238*/
	{3,0,0,0,0,0,0,0},/*239*/
	{4,5,6,7,0,0,0,0},/*240*/
	{4,5,6,0,0,0,0,0},/*241*/
	{4,5,7,0,0,0,0,0},/*242*/
	{4,5,0,0,0,0,0,0},/*243*/
	{4,6,7,0,0,0,0,0},/*244*/
	{4,6,0,0,0,0,0,0},/*245*/
	{4,7,0,0,0,0,0,0},/*246*/
	{4,0,0,0,0,0,0,0},/*247*/
	{5,6,7,0,0,0,0,0},/*248*/
	{5,6,0,0,0,0,0,0},/*249*/
	{5,7,0,0,0,0,0,0},/*250*/
	{5,0,0,0,0,0,0,0},/*251*/
	{6,7,0,0,0,0,0,0},/*252*/
	{6,0,0,0,0,0,0,0},/*253*/
	{7,0,0,0,0,0,0,0},/*254*/
	{0,0,0,0,0,0,0,0},/*255*/
};

//auto gen by gen_free_num_map.cpp
uint8_t off_num_map[256] = 
{
	8, /*0*/
	7, /*1*/
	7, /*2*/
	6, /*3*/
	7, /*4*/
	6, /*5*/
	6, /*6*/
	5, /*7*/
	7, /*8*/
	6, /*9*/
	6, /*10*/
	5, /*11*/
	6, /*12*/
	5, /*13*/
	5, /*14*/
	4, /*15*/
	7, /*16*/
	6, /*17*/
	6, /*18*/
	5, /*19*/
	6, /*20*/
	5, /*21*/
	5, /*22*/
	4, /*23*/
	6, /*24*/
	5, /*25*/
	5, /*26*/
	4, /*27*/
	5, /*28*/
	4, /*29*/
	4, /*30*/
	3, /*31*/
	7, /*32*/
	6, /*33*/
	6, /*34*/
	5, /*35*/
	6, /*36*/
	5, /*37*/
	5, /*38*/
	4, /*39*/
	6, /*40*/
	5, /*41*/
	5, /*42*/
	4, /*43*/
	5, /*44*/
	4, /*45*/
	4, /*46*/
	3, /*47*/
	6, /*48*/
	5, /*49*/
	5, /*50*/
	4, /*51*/
	5, /*52*/
	4, /*53*/
	4, /*54*/
	3, /*55*/
	5, /*56*/
	4, /*57*/
	4, /*58*/
	3, /*59*/
	4, /*60*/
	3, /*61*/
	3, /*62*/
	2, /*63*/
	7, /*64*/
	6, /*65*/
	6, /*66*/
	5, /*67*/
	6, /*68*/
	5, /*69*/
	5, /*70*/
	4, /*71*/
	6, /*72*/
	5, /*73*/
	5, /*74*/
	4, /*75*/
	5, /*76*/
	4, /*77*/
	4, /*78*/
	3, /*79*/
	6, /*80*/
	5, /*81*/
	5, /*82*/
	4, /*83*/
	5, /*84*/
	4, /*85*/
	4, /*86*/
	3, /*87*/
	5, /*88*/
	4, /*89*/
	4, /*90*/
	3, /*91*/
	4, /*92*/
	3, /*93*/
	3, /*94*/
	2, /*95*/
	6, /*96*/
	5, /*97*/
	5, /*98*/
	4, /*99*/
	5, /*100*/
	4, /*101*/
	4, /*102*/
	3, /*103*/
	5, /*104*/
	4, /*105*/
	4, /*106*/
	3, /*107*/
	4, /*108*/
	3, /*109*/
	3, /*110*/
	2, /*111*/
	5, /*112*/
	4, /*113*/
	4, /*114*/
	3, /*115*/
	4, /*116*/
	3, /*117*/
	3, /*118*/
	2, /*119*/
	4, /*120*/
	3, /*121*/
	3, /*122*/
	2, /*123*/
	3, /*124*/
	2, /*125*/
	2, /*126*/
	1, /*127*/
	7, /*128*/
	6, /*129*/
	6, /*130*/
	5, /*131*/
	6, /*132*/
	5, /*133*/
	5, /*134*/
	4, /*135*/
	6, /*136*/
	5, /*137*/
	5, /*138*/
	4, /*139*/
	5, /*140*/
	4, /*141*/
	4, /*142*/
	3, /*143*/
	6, /*144*/
	5, /*145*/
	5, /*146*/
	4, /*147*/
	5, /*148*/
	4, /*149*/
	4, /*150*/
	3, /*151*/
	5, /*152*/
	4, /*153*/
	4, /*154*/
	3, /*155*/
	4, /*156*/
	3, /*157*/
	3, /*158*/
	2, /*159*/
	6, /*160*/
	5, /*161*/
	5, /*162*/
	4, /*163*/
	5, /*164*/
	4, /*165*/
	4, /*166*/
	3, /*167*/
	5, /*168*/
	4, /*169*/
	4, /*170*/
	3, /*171*/
	4, /*172*/
	3, /*173*/
	3, /*174*/
	2, /*175*/
	5, /*176*/
	4, /*177*/
	4, /*178*/
	3, /*179*/
	4, /*180*/
	3, /*181*/
	3, /*182*/
	2, /*183*/
	4, /*184*/
	3, /*185*/
	3, /*186*/
	2, /*187*/
	3, /*188*/
	2, /*189*/
	2, /*190*/
	1, /*191*/
	6, /*192*/
	5, /*193*/
	5, /*194*/
	4, /*195*/
	5, /*196*/
	4, /*197*/
	4, /*198*/
	3, /*199*/
	5, /*200*/
	4, /*201*/
	4, /*202*/
	3, /*203*/
	4, /*204*/
	3, /*205*/
	3, /*206*/
	2, /*207*/
	5, /*208*/
	4, /*209*/
	4, /*210*/
	3, /*211*/
	4, /*212*/
	3, /*213*/
	3, /*214*/
	2, /*215*/
	4, /*216*/
	3, /*217*/
	3, /*218*/
	2, /*219*/
	3, /*220*/
	2, /*221*/
	2, /*222*/
	1, /*223*/
	5, /*224*/
	4, /*225*/
	4, /*226*/
	3, /*227*/
	4, /*228*/
	3, /*229*/
	3, /*230*/
	2, /*231*/
	4, /*232*/
	3, /*233*/
	3, /*234*/
	2, /*235*/
	3, /*236*/
	2, /*237*/
	2, /*238*/
	1, /*239*/
	4, /*240*/
	3, /*241*/
	3, /*242*/
	2, /*243*/
	3, /*244*/
	2, /*245*/
	2, /*246*/
	1, /*247*/
	3, /*248*/
	2, /*249*/
	2, /*250*/
	1, /*251*/
	2, /*252*/
	1, /*253*/
	1, /*254*/
	0, /*255*/
};

uint8_t on_list_map[256][8]=
{
	{0,0,0,0,0,0,0,0},/*0*/
	{7,0,0,0,0,0,0,0},/*1*/
	{6,0,0,0,0,0,0,0},/*2*/
	{6,7,0,0,0,0,0,0},/*3*/
	{5,0,0,0,0,0,0,0},/*4*/
	{5,7,0,0,0,0,0,0},/*5*/
	{5,6,0,0,0,0,0,0},/*6*/
	{5,6,7,0,0,0,0,0},/*7*/
	{4,0,0,0,0,0,0,0},/*8*/
	{4,7,0,0,0,0,0,0},/*9*/
	{4,6,0,0,0,0,0,0},/*10*/
	{4,6,7,0,0,0,0,0},/*11*/
	{4,5,0,0,0,0,0,0},/*12*/
	{4,5,7,0,0,0,0,0},/*13*/
	{4,5,6,0,0,0,0,0},/*14*/
	{4,5,6,7,0,0,0,0},/*15*/
	{3,0,0,0,0,0,0,0},/*16*/
	{3,7,0,0,0,0,0,0},/*17*/
	{3,6,0,0,0,0,0,0},/*18*/
	{3,6,7,0,0,0,0,0},/*19*/
	{3,5,0,0,0,0,0,0},/*20*/
	{3,5,7,0,0,0,0,0},/*21*/
	{3,5,6,0,0,0,0,0},/*22*/
	{3,5,6,7,0,0,0,0},/*23*/
	{3,4,0,0,0,0,0,0},/*24*/
	{3,4,7,0,0,0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*/
	{1,2,4,5,6,7,0,0},/*111*/
	{1,2,3,0,0,0,0,0},/*112*/
	{1,2,3,7,0,0,0,0},/*113*/
	{1,2,3,6,0,0,0,0},/*114*/
	{1,2,3,6,7,0,0,0},/*115*/
	{1,2,3,5,0,0,0,0},/*116*/
	{1,2,3,5,7,0,0,0},/*117*/
	{1,2,3,5,6,0,0,0},/*118*/
	{1,2,3,5,6,7,0,0},/*119*/
	{1,2,3,4,0,0,0,0},/*120*/
	{1,2,3,4,7,0,0,0},/*121*/
	{1,2,3,4,6,0,0,0},/*122*/
	{1,2,3,4,6,7,0,0},/*123*/
	{1,2,3,4,5,0,0,0},/*124*/
	{1,2,3,4,5,7,0,0},/*125*/
	{1,2,3,4,5,6,0,0},/*126*/
	{1,2,3,4,5,6,7,0},/*127*/
	{0,0,0,0,0,0,0,0},/*128*/
	{0,7,0,0,0,0,0,0},/*129*/
	{0,6,0,0,0,0,0,0},/*130*/
	{0,6,7,0,0,0,0,0},/*131*/
	{0,5,0,0,0,0,0,0},/*132*/
	{0,5,7,0,0,0,0,0},/*133*/
	{0,5,6,0,0,0,0,0},/*134*/
	{0,5,6,7,0,0,0,0},/*135*/
	{0,4,0,0,0,0,0,0},/*136*/
	{0,4,7,0,0,0,0,0},/*137*/
	{0,4,6,0,0,0,0,0},/*138*/
	{0,4,6,7,0,0,0,0},/*139*/
	{0,4,5,0,0,0,0,0},/*140*/
	{0,4,5,7,0,0,0,0},/*141*/
	{0,4,5,6,0,0,0,0},/*142*/
	{0,4,5,6,7,0,0,0},/*143*/
	{0,3,0,0,0,0,0,0},/*144*/
	{0,3,7,0,0,0,0,0},/*145*/
	{0,3,6,0,0,0,0,0},/*146*/
	{0,3,6,7,0,0,0,0},/*147*/
	{0,3,5,0,0,0,0,0},/*148*/
	{0,3,5,7,0,0,0,0},/*149*/
	{0,3,5,6,0,0,0,0},/*150*/
	{0,3,5,6,7,0,0,0},/*151*/
	{0,3,4,0,0,0,0,0},/*152*/
	{0,3,4,7,0,0,0,0},/*153*/
	{0,3,4,6,0,0,0,0},/*154*/
	{0,3,4,6,7,0,0,0},/*155*/
	{0,3,4,5,0,0,0,0},/*156*/
	{0,3,4,5,7,0,0,0},/*157*/
	{0,3,4,5,6,0,0,0},/*158*/
	{0,3,4,5,6,7,0,0},/*159*/
	{0,2,0,0,0,0,0,0},/*160*/
	{0,2,7,0,0,0,0,0},/*161*/
	{0,2,6,0,0,0,0,0},/*162*/
	{0,2,6,7,0,0,0,0},/*163*/
	{0,2,5,0,0,0,0,0},/*164*/
	{0,2,5,7,0,0,0,0},/*165*/
	{0,2,5,6,0,0,0,0},/*166*/
	{0,2,5,6,7,0,0,0},/*167*/
	{0,2,4,0,0,0,0,0},/*168*/
	{0,2,4,7,0,0,0,0},/*169*/
	{0,2,4,6,0,0,0,0},/*170*/
	{0,2,4,6,7,0,0,0},/*171*/
	{0,2,4,5,0,0,0,0},/*172*/
	{0,2,4,5,7,0,0,0},/*173*/
	{0,2,4,5,6,0,0,0},/*174*/
	{0,2,4,5,6,7,0,0},/*175*/
	{0,2,3,0,0,0,0,0},/*176*/
	{0,2,3,7,0,0,0,0},/*177*/
	{0,2,3,6,0,0,0,0},/*178*/
	{0,2,3,6,7,0,0,0},/*179*/
	{0,2,3,5,0,0,0,0},/*180*/
	{0,2,3,5,7,0,0,0},/*181*/
	{0,2,3,5,6,0,0,0},/*182*/
	{0,2,3,5,6,7,0,0},/*183*/
	{0,2,3,4,0,0,0,0},/*184*/
	{0,2,3,4,7,0,0,0},/*185*/
	{0,2,3,4,6,0,0,0},/*186*/
	{0,2,3,4,6,7,0,0},/*187*/
	{0,2,3,4,5,0,0,0},/*188*/
	{0,2,3,4,5,7,0,0},/*189*/
	{0,2,3,4,5,6,0,0},/*190*/
	{0,2,3,4,5,6,7,0},/*191*/
	{0,1,0,0,0,0,0,0},/*192*/
	{0,1,7,0,0,0,0,0},/*193*/
	{0,1,6,0,0,0,0,0},/*194*/
	{0,1,6,7,0,0,0,0},/*195*/
	{0,1,5,0,0,0,0,0},/*196*/
	{0,1,5,7,0,0,0,0},/*197*/
	{0,1,5,6,0,0,0,0},/*198*/
	{0,1,5,6,7,0,0,0},/*199*/
	{0,1,4,0,0,0,0,0},/*200*/
	{0,1,4,7,0,0,0,0},/*201*/
	{0,1,4,6,0,0,0,0},/*202*/
	{0,1,4,6,7,0,0,0},/*203*/
	{0,1,4,5,0,0,0,0},/*204*/
	{0,1,4,5,7,0,0,0},/*205*/
	{0,1,4,5,6,0,0,0},/*206*/
	{0,1,4,5,6,7,0,0},/*207*/
	{0,1,3,0,0,0,0,0},/*208*/
	{0,1,3,7,0,0,0,0},/*209*/
	{0,1,3,6,0,0,0,0},/*210*/
	{0,1,3,6,7,0,0,0},/*211*/
	{0,1,3,5,0,0,0,0},/*212*/
	{0,1,3,5,7,0,0,0},/*213*/
	{0,1,3,5,6,0,0,0},/*214*/
	{0,1,3,5,6,7,0,0},/*215*/
	{0,1,3,4,0,0,0,0},/*216*/
	{0,1,3,4,7,0,0,0},/*217*/
	{0,1,3,4,6,0,0,0},/*218*/
	{0,1,3,4,6,7,0,0},/*219*/
	{0,1,3,4,5,0,0,0},/*220*/
	{0,1,3,4,5,7,0,0},/*221*/
	{0,1,3,4,5,6,0,0},/*222*/
	{0,1,3,4,5,6,7,0},/*223*/
	{0,1,2,0,0,0,0,0},/*224*/
	{0,1,2,7,0,0,0,0},/*225*/
	{0,1,2,6,0,0,0,0},/*226*/
	{0,1,2,6,7,0,0,0},/*227*/
	{0,1,2,5,0,0,0,0},/*228*/
	{0,1,2,5,7,0,0,0},/*229*/
	{0,1,2,5,6,0,0,0},/*230*/
	{0,1,2,5,6,7,0,0},/*231*/
	{0,1,2,4,0,0,0,0},/*232*/
	{0,1,2,4,7,0,0,0},/*233*/
	{0,1,2,4,6,0,0,0},/*234*/
	{0,1,2,4,6,7,0,0},/*235*/
	{0,1,2,4,5,0,0,0},/*236*/
	{0,1,2,4,5,7,0,0},/*237*/
	{0,1,2,4,5,6,0,0},/*238*/
	{0,1,2,4,5,6,7,0},/*239*/
	{0,1,2,3,0,0,0,0},/*240*/
	{0,1,2,3,7,0,0,0},/*241*/
	{0,1,2,3,6,0,0,0},/*242*/
	{0,1,2,3,6,7,0,0},/*243*/
	{0,1,2,3,5,0,0,0},/*244*/
	{0,1,2,3,5,7,0,0},/*245*/
	{0,1,2,3,5,6,0,0},/*246*/
	{0,1,2,3,5,6,7,0},/*247*/
	{0,1,2,3,4,0,0,0},/*248*/
	{0,1,2,3,4,7,0,0},/*249*/
	{0,1,2,3,4,6,0,0},/*250*/
	{0,1,2,3,4,6,7,0},/*251*/
	{0,1,2,3,4,5,0,0},/*252*/
	{0,1,2,3,4,5,7,0},/*253*/
	{0,1,2,3,4,5,6,0},/*254*/
	{0,1,2,3,4,5,6,7},/*255*/
};

uint8_t on_num_map[256] = 
{
0, /*0*/
1, /*1*/
1, /*2*/
2, /*3*/
1, /*4*/
2, /*5*/
2, /*6*/
3, /*7*/
1, /*8*/
2, /*9*/
2, /*10*/
3, /*11*/
2, /*12*/
3, /*13*/
3, /*14*/
4, /*15*/
1, /*16*/
2, /*17*/
2, /*18*/
3, /*19*/
2, /*20*/
3, /*21*/
3, /*22*/
4, /*23*/
2, /*24*/
3, /*25*/
3, /*26*/
4, /*27*/
3, /*28*/
4, /*29*/
4, /*30*/
5, /*31*/
1, /*32*/
2, /*33*/
2, /*34*/
3, /*35*/
2, /*36*/
3, /*37*/
3, /*38*/
4, /*39*/
2, /*40*/
3, /*41*/
3, /*42*/
4, /*43*/
3, /*44*/
4, /*45*/
4, /*46*/
5, /*47*/
2, /*48*/
3, /*49*/
3, /*50*/
4, /*51*/
3, /*52*/
4, /*53*/
4, /*54*/
5, /*55*/
3, /*56*/
4, /*57*/
4, /*58*/
5, /*59*/
4, /*60*/
5, /*61*/
5, /*62*/
6, /*63*/
1, /*64*/
2, /*65*/
2, /*66*/
3, /*67*/
2, /*68*/
3, /*69*/
3, /*70*/
4, /*71*/
2, /*72*/
3, /*73*/
3, /*74*/
4, /*75*/
3, /*76*/
4, /*77*/
4, /*78*/
5, /*79*/
2, /*80*/
3, /*81*/
3, /*82*/
4, /*83*/
3, /*84*/
4, /*85*/
4, /*86*/
5, /*87*/
3, /*88*/
4, /*89*/
4, /*90*/
5, /*91*/
4, /*92*/
5, /*93*/
5, /*94*/
6, /*95*/
2, /*96*/
3, /*97*/
3, /*98*/
4, /*99*/
3, /*100*/
4, /*101*/
4, /*102*/
5, /*103*/
3, /*104*/
4, /*105*/
4, /*106*/
5, /*107*/
4, /*108*/
5, /*109*/
5, /*110*/
6, /*111*/
3, /*112*/
4, /*113*/
4, /*114*/
5, /*115*/
4, /*116*/
5, /*117*/
5, /*118*/
6, /*119*/
4, /*120*/
5, /*121*/
5, /*122*/
6, /*123*/
5, /*124*/
6, /*125*/
6, /*126*/
7, /*127*/
1, /*128*/
2, /*129*/
2, /*130*/
3, /*131*/
2, /*132*/
3, /*133*/
3, /*134*/
4, /*135*/
2, /*136*/
3, /*137*/
3, /*138*/
4, /*139*/
3, /*140*/
4, /*141*/
4, /*142*/
5, /*143*/
2, /*144*/
3, /*145*/
3, /*146*/
4, /*147*/
3, /*148*/
4, /*149*/
4, /*150*/
5, /*151*/
3, /*152*/
4, /*153*/
4, /*154*/
5, /*155*/
4, /*156*/
5, /*157*/
5, /*158*/
6, /*159*/
2, /*160*/
3, /*161*/
3, /*162*/
4, /*163*/
3, /*164*/
4, /*165*/
4, /*166*/
5, /*167*/
3, /*168*/
4, /*169*/
4, /*170*/
5, /*171*/
4, /*172*/
5, /*173*/
5, /*174*/
6, /*175*/
3, /*176*/
4, /*177*/
4, /*178*/
5, /*179*/
4, /*180*/
5, /*181*/
5, /*182*/
6, /*183*/
4, /*184*/
5, /*185*/
5, /*186*/
6, /*187*/
5, /*188*/
6, /*189*/
6, /*190*/
7, /*191*/
2, /*192*/
3, /*193*/
3, /*194*/
4, /*195*/
3, /*196*/
4, /*197*/
4, /*198*/
5, /*199*/
3, /*200*/
4, /*201*/
4, /*202*/
5, /*203*/
4, /*204*/
5, /*205*/
5, /*206*/
6, /*207*/
3, /*208*/
4, /*209*/
4, /*210*/
5, /*211*/
4, /*212*/
5, /*213*/
5, /*214*/
6, /*215*/
4, /*216*/
5, /*217*/
5, /*218*/
6, /*219*/
5, /*220*/
6, /*221*/
6, /*222*/
7, /*223*/
3, /*224*/
4, /*225*/
4, /*226*/
5, /*227*/
4, /*228*/
5, /*229*/
5, /*230*/
6, /*231*/
4, /*232*/
5, /*233*/
5, /*234*/
6, /*235*/
5, /*236*/
6, /*237*/
6, /*238*/
7, /*239*/
4, /*240*/
5, /*241*/
5, /*242*/
6, /*243*/
5, /*244*/
6, /*245*/
6, /*246*/
7, /*247*/
5, /*248*/
6, /*249*/
6, /*250*/
7, /*251*/
6, /*252*/
7, /*253*/
7, /*254*/
8, /*255*/
};
#if 0
//file: gen_free_list.cpp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
char out[1024*10]={0};
int off=0;

snprintf( out+off, sizeof(out)-off, "%s\n", "{");
off= strlen(out);
	char buff[256*5]={0};
	int offset=0;
	bool first=true;
for(int i=0; i<256; i++)
{
	
	memset( buff, sizeof(buff), 0x00);
	snprintf( buff, sizeof(buff), "%s", "{0,0,0,0,0,0,0,0}");
	first = true;
	offset = 1;
	for( int j=0; j<8; j++)
	{
		int k=i;
		k=k<<j;	
		if(!(k & 0x80))
		{
			if(first)
			{
				char tmp[3]={0};
				snprintf( tmp, sizeof(tmp), "%d", j);
				memcpy( buff+offset, tmp, strlen(tmp));
				offset += strlen(tmp);
				first = false;
			}
			else
			{
				char tmp[3]={0};
				snprintf( tmp, sizeof(tmp), ",%d", j);
				memcpy( buff+offset, tmp, strlen(tmp));
				offset += strlen(tmp);
			}
		}
		//printf("buff:%s\n", buff);
	}
//printf("buff:%s\n", buff);
snprintf( out+off, sizeof(out)-off, "%15s,/*%d*/\n", buff, i);
off= strlen(out);
}
snprintf( out+off, sizeof(out)-off, "%s\n", "}");
off= strlen(out);
printf("%s", out);
	return 0;
}
#endif

#if 0
//file: gen_free_num.cpp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
for(int i=0; i<256; i++)
{
	int n = 0;	
	for( int j=0; j<8; j++)
	{
		int k=i;
		k=k<<j;	
		if(!(k & 0x80))
		{
			n++;
		}
	}
	printf("%d, /*%d*/\n", n, i);
}
	return 0;
}
#endif

